<template>
	<view>
		<uni-nav-bar left-icon="arrowthinleft" title="我的发布" :border="false" :fixed="true" bg="bg-fff" color="#333"
			@clickLeft="goBack()"></uni-nav-bar>
		<view class="nav_top flex align-center bg-fff padding-bottom-20">
			<view class="flex1 nav_top_nav text-center flex align-center">
				<view class="nav_top_nav_item flex1" :class="{'on':navCurrent == index}" v-for="(item, index) in nav"
					:key="index" @tap="toggle(index)">{{item}}</view>
			</view>
		</view>
		<view class="bg-f7f7f7 w100" style="height: 10rpx;"></view>
		<!-- 招聘 -->
		<view v-if="navCurrent == 0">
			<view v-for="(item,index) in list1" :key='index' @tap.stop="jump('/pages/qiuzhi/fb_two?id='+item.id)"
				class="bg-fff  radius10 padding-x-24 padding-y-30 margin-bottom-30 solid-bottom">
				<view class="flex align-center justify-between padding-bottom-24">
					<text class="fs-26 color-666">{{item.create_time}}</text>
					<text class="fs-28 color-zhuse">{{ status[item.status] }}</text>
				</view>

				<!-- <image style="width: 120rpx;height: 120rpx;border-radius: 100%;" src="../../static/img/img.jpg"></image> -->

				<view class="flex align-center justify-between">
					<view class="flex1">
						<view class="flex align-center justify-between">
							<view class="flex align-center">
								<view class="fs-28 color-000">{{item.position}}</view>
								<!-- <image style="width: 26rpx;height: 26rpx;" :src="item.sex == '男' ?'../../static/img/nan.png':'../../static/img/nv.png'"></image> -->
							</view>

						</view>
						<view class="fs-24 color-666 margin-top-10">{{item.experience}}· 工作时间{{item.time}}
							·{{item.education}} </view>
						<view class="fs-22 color-666 margin-top-10">薪资 {{item.income}} <text
								class="margin-left-30">地点:{{item.address}}</text></view>
					</view>
					<view class="public_btn-xs" @tap.stop="del(item.id)" style="background: #999;">删除</view>
				</view>

			</view>
			<empty v-if="list1.length < 1"></empty>

		</view>
		<!-- 招聘end -->
		<!-- 出租 -->
		<view v-if="navCurrent == 1">
			<view v-for="(item,index) in list2" :key='index' @tap.stop="jump('/pages/fabu/fabu?id='+item.id)"
				class="bg-fff solid-bottom padding-y-10 padding-x-24 ">
				<view class="flex align-center justify-between padding-y-16">
					<text class="fs-26 color-666">{{item.create_time}}</text>
					<text class="fs-28 color-zhuse">{{ status[item.status] }}</text>
				</view>
				<view class="flex align-center justify-between">
					<view class="flex1 margin-right-24">
						<view class="text-cut fs-28 color-333 fw-600">{{item.title}}</view>
						<view class="fs-24 color-666 margin-top-10">{{item.flat}}·{{item.area}}cm²·{{item.floor}}楼</view>
						<!-- 		<view class="flex align-center margin-top-16">
								<text class="color-fuse fs-20" style="padding:4rpx 6rpx;transform: scale(0.8); border: 1rpx solid #FF932E;border-radius: 6rpx; ">押一付一</text>
								<text class="color-fuse fs-20" style="padding:4rpx 6rpx;transform: scale(0.8);  border: 1rpx solid #FF932E;border-radius: 6rpx; ">押一付一</text>
							</view> -->
						<view class="margin-top-10  fs-32 color-zhuse">¥{{item.price}}</view>
					</view>
					<view class="public_btn-xs" @tap.stop="delChuzu(item.id)" style="background: #999;">删除</view>
					<!-- <image class="goods_img radius10" :src="item.images"></image> -->
				</view>

			</view>

			<empty v-if="list2.length < 1"></empty>
		</view>
		<!-- 出租end -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nav: ['招聘', '出租/出售'],
				navCurrent: 0,
				list1: [],
				list2: [],
				status: ['审核中', '已通过', '已驳回']
			}
		},
		onLoad() {
			this.getIndex();
			this.getTwo();
		},
		methods: {

			getIndex() {
				// this.isLoading = true;
				this.$api.main_publish_recruit().then(res => {
					if (res.code == 1) {
						// this.isLoading = false;
						this.list1 = res.data.data;
						// if (res.data.offline.data.length != 0) {
						// 	this.hasMore = true;
						// 	this.loadStatus = '';
						// } else {
						// 	this.hasMore = false;
						// 	this.loadStatus = 'over';
						// }
					}
				})
			},
			getTwo() {
				// this.isLoading = true;
				this.$api.main_publish_house().then(res => {
					if (res.code == 1) {
						// this.isLoading = false;
						this.list2 = res.data.data;
						// if (res.data.offline.data.length != 0) {
						// 	this.hasMore = true;
						// 	this.loadStatus = '';
						// } else {
						// 	this.hasMore = false;
						// 	this.loadStatus = 'over';
						// }
					}
				})
			},

			// 删除招聘
			del(id) {
				this.$api.del_main_publish_recruit({id: id}).then(res => {
					if (res.code == 1) {
						this.getIndex()
					} else {
						this.$msg(res.msg)
					}
				})
			},
			
			// 删除出租
			delChuzu(id) {
				this.$api.del_main_publish_house({id: id}).then(res => {
					if (res.code == 1) {
						this.getTwo()
					} else {
						this.$msg(res.msg)
					}
				})
			},

			toggle(index) {
				this.navCurrent = index
			}
		}
	}
</script>

<style lang="scss" scoped>
	.goods_img {
		width: 280rpx;
		height: 180rpx;
		border-radius: 10rpx;
	}

	.nav_top {
		width: 100%;
		position: sticky;
		top: 88rpx;
		left: 0;
		z-index: 9;
	}

	.nav_more_wrap {
		width: 80rpx;
		height: 80rpx;
		background-color: #fff;
		box-shadow: -10rpx 0 10rpx #F5F5F5;

		.nav_more {
			width: 28rpx;
			height: 28rpx;
		}
	}

	.nav_top_nav {
		overflow-x: auto;
		padding: 10rpx 0;
		white-space: nowrap;
	}

	.nav_top_nav::-webkit-scrollbar,
	.search_left::-webkit-scrollbar,
	.youxuan_top::-webkit-scrollbar {
		display: none;
		width: 0;
		height: 0;
		color: transparent;
	}

	.nav_top_nav_item {
		position: relative;
		padding: 0 20rpx;
		font-size: 30rpx;
		color: #666;
		line-height: 42rpx;
	}

	.nav_top_nav_item.on:after {
		content: "";
		width: 42rpx;
		height: 6rpx;
		background-color: $uni-color-zhuse;
		position: absolute;
		bottom: -10rpx;
		left: 50%;
		transform: translate(-50%, 0);
	}
</style>
